#!/bin/sh
#
# Author: Hayaki Saito, 2015
#

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
include_dir=@includedir@
bindir=@bindir@
datadir=@datadir@
datarootdir=@datarootdir@
mandir=@mandir@

LANG=C;		export LANG
LANGUAGE=C;	export LANGUAGE
LC_ALL=C;	export LC_ALL
LC_CTYPE=C;	export LC_CTYPE

test $# = 0 && exec /bin/sh $0 --error

while test $# -gt 0; do
	case "$1" in
	# basic configuration
	--prefix)
		echo "$prefix"
		;;
	--exec-prefix)
		echo "${exec_prefix}"
		;;
	# compile/link
	--cflags)
		echo "-I${include_dir}"
		;;
	--libs)
		echo "-L${libdir} -lsixel"
		;;
	# identification
	--version)
		echo @PACKAGE_VERSION@
		;;
	--abi-version)
		echo @LS_LTVERSION@ | tr : .
		;;
	# locations
	--bindir)
		echo "${bindir}"
		;;
	--datadir)
		echo "${datadir}"
		;;
	--datarootdir)
		echo "${datarootdir}"
		;;
	--libdir)
		echo "${libdir}"
		;;
	--mandir)
		echo "${mandir}"
		;;
	# general info
	--help)
		cat <<ENDHELP
Usage: libsixel-config [options]

Options:
  --prefix           echos the package-prefix of libsixel
  --exec-prefix      echos the executable-prefix of libsixel

  --cflags           echos the C compiler flags needed to compile with libsixel
  --libs             echos the libraries needed to link with libsixel

  --version          echos the release+patchdate version of libsixel
  --abi-version      echos the ABI version of libsixel

  --bindir           echos the directory containing libsixel programs
  --datadir          echos the directory containing libsixel data
  --libdir           echos the directory containing libsixel libraries
  --mandir           echos the directory containing libsixel manpages

  --help             prints this message
ENDHELP
		;;
	--error|*)
		/bin/sh $0 --help 1>&2
		exit 1
		;;
	esac
	shift
done
